<?php
/**
 * WebProduction Shop (wpshop)
 * @copyright (C) 2011-2012 WebProduction (tm) <webproduction.com.ua>
 *
 * This program is commercial software; you cannot redistribute it and/or
 * modify.
 */

/**
 * @author Egor Gerasimchuk <milhous@webproduction.ua>
 * @copyright WebProduction
 * @package Shop
 */
class Datasource_Photoalbum extends Forms_ADataSourceSQLObject {

    public function getSQLObject() {
        $x = new XPhotoalbum();
        return $x;
    }

    protected function _initialize() {
        $field = new Forms_ContentFieldInt('id');
        $field->setEditable(false);
        $field->setName('#');
        $this->_fieldsArray[] = $field;

        $field = new Forms_ContentField('name');
        $field->setName('Название');
        $field->addValidator(new Forms_ValidatorEmpty());
        $this->_fieldsArray[] = $field;

        $field = new Forms_ContentFieldTextarea('description');
        $field->setName('Описание');
        $this->_fieldsArray[] = $field;

        $field = new Forms_ContentFieldFileImage('image');
        $field->setMediaDirectory('/media/photoalbum/');
        $field->setName('Изображение');
        $this->_fieldsArray[] = $field;

        $field = new Forms_ContentFieldCheckbox('main');
        $field->setName('На главной');
        $this->_fieldsArray[] = $field;

        $field = new Forms_ContentFieldCheckbox('hidden');
        $field->setName('Скрытый');
        $this->_fieldsArray[] = $field;

        $field = new Forms_ContentFieldDatetime('cdate');
        $field->setName('Дата создания');
        $this->_fieldsArray[] = $field;
    }
}
